package no.hio.wsprovider.dao;

import java.util.List;
import java.util.NoSuchElementException;

import no.hio.wsprovider.vo.Product;
/**
 * DataAccessObject for Product.
 * @see Product
 * @version 1.0
 * @author andreas
 *
 */
public interface ProductDAO {
	
	/**
	 * Returns all products.
	 * @return List with all products.
	 */
	public List<Product> findAll();
	
	/**
	 * Returns matching products given a whole or partial title.
	 * 
	 * @param title Search term
	 * @return List with matching products.
	 */
	public List<Product> findByTitle(String title);
	
	/**
	 * Returns matching products given a whole or partial description.
	 * @param description Search term
	 * @return List with matching products
	 */
	public List<Product> findbyDescription(String description);
	
	/**
	 * 
	 * Returns one matching product given the products ID
	 * 
	 * @param productID 
	 * @return Product with given ID
	 */
	public Product findByProductID(int productID);
	
	/**
	 * Commits changes to the datasource. 
	 * @param p Product to be saved
	 * @return 
	 * @throws UnsupportedOperationException
	 */
	public int insert(Product p) throws UnsupportedOperationException;
	
	/**
	 * Updates object with values from datasource.
	 * @param p Product to be updated
	 */
	public void update(Product p) throws NoSuchElementException;
	
	/**
	 * Removes product from datasource
	 * @param p Product to be removed.
	 */
	public void remove(Product p) throws NoSuchElementException;
	
}
